/*
 * graph2D
 * Copyright (c) 2009 Shun Moriya <shun@mnu.sakura.ne.jp>
 *
 * The MIT License
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

native void loadImage(string filename);
native void fade(float r, float g, float b, float a, float second);

native int create(float x, float y, float w, float h);
/*
コールバックのしかけが必要？
native int createComponent(float x, float y, float w, float h);
native int createContainer(float x, float y, float w, float h);
native int createButton(float x, float y, float w, float h. string label);
*/
native void destroy(int id);
native void touchable(int id, int enable);

native void changeScene(int type);
native void swapScene();
native int getScene();

native void setLayer(int parent, int layer, int id);
native void swapLayer(int parent, int to, int from);
native void releaseLayer(int parent, int layer);

native void setPosition(int id, float x, float y);
native void setSize(int id, float w, float h);
native void setScale(int id, float x, float y, float second);
native void setColor(int id, float r, float g, float b, float a, float second);

native void loadTexture(int id, string filename);
native void setTextureScroll(int id, float x, float y);

native void loadScript(int id, string filename);

native void setCellAnimation(int id, float x, float y, float width, float height, float wait, int count, int loopCount);
native void startCellAnimation(int id);
native void stopCellAnimation(int id);
native void setCellNumber(int id, int pattern);

native void addAnimation(int id, string name, float x, float y, float w, float h, float wait, int count, int loopCount);
native void removeAnimation(int id, string name);
native void setAnimation(int id, string name);
native void waitAnimation(int id);

native void move(int id, float x, float y, float time);
native void moveFinish(int id);

native void jump(int id, float time, float height);
native void shake(int id, float time, float amplitude);

native void openMessageWindow();
native void closeMessageWindow();
native void showMessage(string text);
native void setMessage(string text);
native void waitMessage();
native void setMessageColor(float r, float g, float b, float a);

/*!
 * @brief		メッセージ表示後の待機時間を設定します
 * @param[in]	delayTimer	0ならタッチを待ちます。正の値なら指定秒数後閉じます。負の値ならば表示したままです。
 */
native void setMessageDelayTimer(float delayTimer);

native int select(string text);
native int touch();
native int checkTouch(int initial);

// audio
native int talk(string filename);
native int playMusic(string filename, float volume, float time);
native void stopMusic(int id, float volume, float time);
native void setMusicVolume(int id, float volume, float time);

// sound
native int loadSound(string filename);
native void releaseSound(int id);
native void playSound(int id);
